home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Hacks / Hacks ’89 / gadlife / source (ugly) / main.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-06-14  |  4.2 KB  |  134 lines  |  [TEXT/KAHL]

  1. #define    NULL            0L
  2. #define    ETX            3
  3. #define    DEL            8
  4. #define     CR            13
  5.  
  6. #define    pasStrLen        256
  7. #define    numStrLen    14
  8. #define    buttonDelay    8L            /* ticks to hold down a keyboard-activated button.    */
  9. #define    waitTime        4L            /* ticks to give multifinder when nothing is going on.    */
  10. #define    longMask        0xfffc
  11. #define    wordMask        0xfffe
  12. #define    deactiveMask    0xfffe
  13. #define    maxCopyBits    3072
  14.  
  15. #define    forceStop        1            /* flags for stopData - dontForceStop allows the    */
  16. #define    dontForceStop    0            /* current copy to complete later, not now.        */
  17.  
  18. #define    dataWind        128
  19.  
  20. #define    resumeFlag        1
  21. #define    clipFlag            2
  22. #define    srEvt            1
  23. #define    mmEvt            0xfa
  24.  
  25. #define    nothingElseToDo    4
  26. #define    someElseToDo        3
  27. #define    lotsElseToDo        2
  28.  
  29. #define    noGray            0
  30. #define    someGray            1
  31. #define    allGray            2
  32.  
  33. #define    maxDataPlanes        2
  34. #define    defaultDataWidth    129
  35. #define    defaultDataHeight    129
  36.  
  37. /* str# resource numbers and names for the strings in them */
  38.  
  39. #define    statStrings    128
  40. #define    genStr        1
  41.  
  42. #define    windTitles        129
  43. #define    newWindTitle    1
  44.  
  45. #define    fontNames        130        /* strings containing *names* of fonts used.    */
  46. #define    fontSizeStrs    131        /* sizes corresponding to the above.            */
  47. #define    statFont        1
  48.  
  49. #define    panicStrs        132
  50. #define    diskPanic        1
  51. #define    rsrcPanic        2
  52. #define    memPanic        3
  53. #define    scrapPanic    4
  54.  
  55. /* constants designed to make 9pt Geneva look good */
  56.  
  57. #define    minFontSize    9
  58. #define    leftMargin        3
  59. #define    topMargin        2
  60. #define    scrollSize        16
  61. #define    scrollSpace    15
  62.  
  63. #define    min(x,y)        ((x)<(y)?(x):(y))
  64. #define    max(x,y)        ((x)>(y)?(x):(y))
  65. #define    delta(x,y)        ((x)>(y)?(x)-(y):(y)-(x))
  66.  
  67. typedef struct dataFontInfo {
  68.     int                number;                /* font number - converted to name for save.    */
  69.     int                size;
  70.     int                topSpace;
  71.     int                topStart;
  72.     int                genStart;
  73. } dataFontInfo, *dataFontPtr, **dataFontHandle;
  74.  
  75. typedef struct dataState {
  76.     struct dataState    **next, **prev;        /* maintain a doubly-linked list of dataStates.    */
  77.     WindowPtr        parent;                /* sometimes we only have the dataHandle.    */
  78.     BitMap            offBits;                /* off-screen bitmap, used with any of bases    */
  79.     char                *bases[maxDataPlanes];    /* current and next planes of data.            */
  80.     Rect                dataRect;                /* active rectangle within the portRect        */
  81.     long                planeSize;                /* total amount of memory in each plane        */
  82.     long                changed;                /* tickcount at time of last change to the data    */
  83.     long                generation;            /* total count of changes to the system        */
  84.     int                planes;                /* number of planes in actual use.            */
  85.     int                partDone;                /* status of generating the next state.        */
  86.     int                state;                /* dataStopped, dataStepping, or dataRunning    */
  87.     int                flags;                /* whether there is a statline, etc.            */
  88.     struct dataFontInfo    theFont;                /* describes font used for generation counter.    */
  89.  
  90. #define    dataStopped    0
  91. #define    dataStepping    1
  92. #define    dataRunning    2
  93.  
  94. #define    dataStatLine    1
  95.  
  96.     BitMap            allBits;                /* off-screen, just the size of the window.    */
  97.     long                lastGeneration;            /* last generation # that was actually drawn.    */
  98.     int                lastGenWidth;            /* pixel width of the last generation # drawn.    */
  99.     int                allBitsState;            /* validity of the bitmap used to compose.    */
  100.  
  101. #define    bitsBadData    1
  102. #define    bitsBadSel        2
  103. #define    bitsBadFrame    4
  104. #define    bitsBadGen    8
  105. #define    bitsBadAnts    16
  106.  
  107.     BitMap            selBits;                /* bounds are selection bounds, has data in it.    */
  108.     RgnHandle            selRgn;                /* the region of the selection within selBits.    */
  109.     long                antTick;                /* which tick the ants last changed on.        */
  110.     int                isSelect;                /* whether there is currently a selection.        */
  111.     int                selActive;                /* whether it is crawling or not...            */
  112.     int                antSkew;                /* which ant pattern this window is on.        */
  113.  
  114.     Handle            cycleBase;            /* used to detect cycles - a copy of one state.    */
  115.     long                cycleGeneration;        /* generation of the cycleBase bits.            */
  116.     long                cycleLength;            /* length of the cycles being detected.        */
  117.     long                cycleFitLength;            /* used to figure out the minimal cycle length.    */
  118.     int                cycleFlags;            /* current cycle detection mode.            */
  119.  
  120. #define    cycleNone        0
  121. #define    cycleRestart    1
  122. #define    cycleDetect    2
  123.  
  124.     BitMap            undoSelBits;
  125.     RgnHandle            undoSelRgn;
  126.     long                undoGeneration;        /* generation of the other plane.            */
  127.     int                undoFlags;                /* what sort of undo-able action there is.        */
  128.  
  129. #define    undoNone        0
  130. #define    undoData        1
  131. #define    undoSelect    2
  132.  
  133. } dataState, *dataPtr, **dataHandle;
  134.